const api = require('../../network/api')

Page({

    /**
     * 页面的初始数据
     */
    data: {
        active: 'frist',
        uid: 0,
        reads: []
    },
    onLoad(option) {

    },
    onShow() {
        let user = wx.getStorageSync('userInfo');
        this.setData({
            uid: user.id
        })
        this.init(this.data.uid)
    },
    async init(uid) {
        const res = await api.historicalRecord({ uid })
        if (res.code == 200) {
            this.setData({
                reads: res.data
            })
        }
        console.log(res, '历史记录');
    },
    onDetail(e) {
        const { chapter_id, comic_id } = e.currentTarget.dataset
        console.log(chapter_id, comic_id);
        wx.navigateTo({
            url: `/pages/cartoon-page/index?chapter_id=${chapter_id}&comic_id=${comic_id}`
        })

    }
})